﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualBasic.FileIO;

namespace SSISFromCode
{

    public abstract class ImportOptions
    {
        public string Path { get; set; }
    }

    public class RowBasedFileImportOptions : ImportOptions
    {
        public bool ColumnNamesInFirstRow { get; set; }
    }

    public class DelimitedImportOptions : RowBasedFileImportOptions, IFlatFileColumnOptions
    {
        public string Qualifier { get; set; }
        public string Delimiter { get; set; }

        public FieldType ColumnFieldType
        {
            get
            {
                return FieldType.Delimited;
            }
        }

        public List<int> ColumnWidths
        {
            get { return null; }
        }

        public bool TextQualified
        {
            get { return true; }
        }
    }

    public class FixedWidthImportOptions : RowBasedFileImportOptions, IFlatFileColumnOptions
    {
        public List<int> ColumnWidths { get; set; }

        public FieldType ColumnFieldType
        {
            get
            {
                return FieldType.FixedWidth;
            }
        }

        public string Delimiter
        {
            get
            {
                return " ";  // this is the delimiter used for the header row
            }
        }

        public bool TextQualified
        {
            get { return false; }
        }
    }

    public class ExcelImportOptions : RowBasedFileImportOptions
    {
        private string _sheetName;

        public string Worksheet
        {
            get
            {
                return _sheetName + '$';
            }
            set
            {
                _sheetName = value;
            }
        }
    }

    public class XMLImportOptions : ImportOptions
    {
    }

}
